package xyz.xtt.asset.api.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author huqibo
 * 
 *         资产状态
 */
public enum ShowStateEnum {
	/**
	 * 销毁
	 */
	DESTORY(0, "销毁"),
	/**
	 * 冻结
	 */
	LOCK(1, "冻结"),
	/**
	 * 上架
	 */
	NORMAL(2, "上架"),
	/**
	 * 下架
	 */
	DOWN(3, "下架");

	/**
	 * 编码
	 */
	private int code;
	/**
	 * 描述
	 */
	private String desc;

	ShowStateEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int code() {
		return code;
	}

	public String desc() {
		return desc;
	}

	public static boolean checkType(String checkType) {
		return Arrays.asList(ShowStateEnum.values()).stream().anyMatch(x -> Objects.equals(x.name(), checkType));
	}

	public static ShowStateEnum convert(String checkType) {
		return Arrays.asList(ShowStateEnum.values()).stream().filter(x -> Objects.equals(x.name(), checkType)).findAny().orElseGet(null);
	}
}
